<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.sql.*" %>
<%@ page import = "treballfinalUF2.Connexio" %>
<jsp:useBean id = "ObjBdades" scope = "page" class = "treballfinalUF2.Connexio" />
<html>
<head>
<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>
<script src="javascripts/carousel-min.js" type="text/javascript"></script>
<script src="javascripts/funcions_formularis.js" type="text/javascript"></script>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>IndexUJB.jsp</title>
<meta http-equiv="Content-Style-Type" content="text/css">
<title> Home </title>

<link HREF="stiles.css" REL="stylesheet" TYPE="text/css" >

<body>


 <%
	//Aqui he creat la BBDD si no existeix. Obro connexio, creo BBDD i la tanco com un senyor
	ObjBdades.establishConnection();
	ObjBdades.creaBBDD();
	ObjBdades.closeMiConnexion();
%>
<div id="contenedor-index">
	<div id="contenedor-form">
		<div id="logins">
			<div id="login-alumno">
			
			<div id="fantasma"></div>
			
				<form action="alumne.jsp" method="post" onsubmit="return checkForm1();">
					<!-- En aquesta pagina hi ha un formulari d'accés  a la pàgina principal i un enllaç  a la pàgina per donar-se d'alta-->
					<h3>Login d'Alumnes</h3>
					<table>
					
					<tr><td>Nom</td><td><input type="text" name="nom" id="nomalumne" /></td></tr>
					<tr><td>Password</td><td><input type="password" name="pass" value="" id="passalumne" /></td></tr>
					<tr><td>Mail</td><td><input type="text" name="mail" value="" id="mailalumne" /></td></tr>
					
					<tr>
					<td colspan=3 >
					<center><input type="submit" value="Accedeix"></center>
					</td>
					</tr>					
					</table>
					 
					
					
				</form>
			</div>
			<div id="login-empresa">
				<form action="insertarOferta.jsp" method="post" onsubmit="return checkForm2();">
					<h3>Login d'Empresas</h3>
					<table>
					<tr><td>Nom Empresa</td><td><input type="text" name="nameEmpresa" value="" id="nomempresa" /></td></tr>
					<tr><td>Password</td><td><input type="password" name="pass" value="" id="passempresa" /><br></td></tr>
					<tr>
					<td colspan=3 >
					<center><input type="submit" value="Accedeix"></center>
					</td>
					</tr>
					</table>
				</form>
			</div>
		</div>
		
		<div id="altas">	 
			<h2><a href="altaAlumne.jsp">Donat d'alta Alumne</a></h2>
			<h2><a href="altaEmpresa.jsp">Donat d'alta Empresa</a></h2>
		</div>
	</div>
	

	   
</div>
<script type="text/javascript" language="javascript">
  // <![CDATA[
  $('carousel-wrapper').appear();
  // ]]>
</script>
<div id="ofertasAlumnes">
<div id="carousel-wrapper">
    <div id="carousel-content">
<%
			//Mostra de ofertes Alumnes
			ResultSet resultAlumne = ObjBdades.retornaOfertaAlumne();
			while (resultAlumne.next()) {
					
					String nomAlumne = resultAlumne.getString("nomalumne");
					String titol = resultAlumne.getString("titol");
					String mail = resultAlumne.getString("mail");
					String descripcio = resultAlumne.getString("descripcio");
		%>
        <div class="slide">
        <div>Oferta de l'alumne <b><%=nomAlumne%></b></div>
        <div><%=titol%></div>
        <div><%=descripcio%></div>
        <span>Contacta: <A HREF="mailto:<%=mail%>"><%=mail%></a></span>
        </div>
        <%
        
			}
        %>
    </div>
</div>
</div>
<script type="text/javascript">// <![CDATA[
            Slider = new Carousel($('carousel-wrapper'), $$('#carousel-wrapper .slide'), $$(' a.carousel-jumper', 'a.carousel-control'), { duration: 0.8, auto: true, frequency: 5, circular: 'false', effect: 'slide', wheel: 'true',   selectedClassName: 'selected'});
// ]]></script>

</body>
</html>